package org.seckill.service;

import org.seckill.dto.Exposer;
import org.seckill.dto.SeckillExecution;
import org.seckill.entity.Seckill;
import org.seckill.exception.RepeatKillException;
import org.seckill.exception.SeckillCloseException;
import org.seckill.exception.SeckillException;

import java.util.List;

/**
 * 业务接口：站在“使用者”角度设计接口
 * 三个方面：定义粒度，参数，返回类型
 * Created by ljd on 2021/1/6.
 */
public interface SeckillService {//ctrl+shift+T生成测试类
    List<Seckill> getSeckillList();
    Seckill getById(long skId);

    /**
     * 秒杀开始时返回秒杀地址
     * 否则输出系统时间和秒杀时间
     * @param skId
     */
    Exposer exportSeckillUrl(long skId);
    //执行秒杀
    SeckillExecution executeSeckill(long seckillId, long userPhone, String md5)
            throws SeckillException,RepeatKillException,SeckillCloseException;
    //执行秒杀，存储过程
    SeckillExecution executeSeckillProcedure(long seckillId, long userPhone, String md5);
}
